﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Ping: UdpEchoClient Class Reference</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                Examples using state machines generated by StateBuilderCpp
            </h1>
            <h3>
                Ping: UdpEchoClient Class Reference
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#signals">Signals</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-slots">Private Slots</a> &#124;
<a href="#pri-attribs">Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">UdpEchoClient Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="UdpEchoClient" -->
<p><code>#include &lt;<a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a>&gt;</code></p>

<p><a href="class_udp_echo_client-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="signals"></a>
Signals</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#a7e5e7c8b80ab2802c056b04370e2f44c">reply</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#a451d983bc262ba9749a711f65de8c77d">UdpEchoClient</a> (QObject *pParent=NULL)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#a1f32d159aaac158aed84b99a11bd7512">~UdpEchoClient</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#af9885baea55efc4fc611605e087d6427">send</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="pri-slots"></a>
Private Slots</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#ab828ca963e7387d8f28cbe8c5f88d8e6">onReply</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUdpSocket *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QHostAddress&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#ab7e8f9607c4478554bebde8c4adc2147">m_address</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#a88d2805cad5ad2dba77336583e5c6702">m_port</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_udp_echo_client.html#a6b5875ed18c71a2a7966fea4362aa814">m_datagram</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock">
<p>Definition at line <a class="el" href="_udp_echo_client_8h_source.html#l00009">9</a> of file <a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a451d983bc262ba9749a711f65de8c77d"></a><!-- doxytag: member="UdpEchoClient::UdpEchoClient" ref="a451d983bc262ba9749a711f65de8c77d" args="(QObject *pParent=NULL)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">UdpEchoClient::UdpEchoClient </td>
          <td>(</td>
          <td class="paramtype">QObject *&#160;</td>
          <td class="paramname"><em>pParent</em> = <code>NULL</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8cpp_source.html#l00008">8</a> of file <a class="el" href="_udp_echo_client_8cpp_source.html">UdpEchoClient.cpp</a>.</p>
<div class="fragment"><pre class="fragment">                                             : QObject(pParent),
  <a class="code" href="class_udp_echo_client.html#ab7e8f9607c4478554bebde8c4adc2147">m_address</a>(QString(<span class="stringliteral">&quot;127.0.0.1&quot;</span>)),
  <a class="code" href="class_udp_echo_client.html#a88d2805cad5ad2dba77336583e5c6702">m_port</a>(2012)
{
    QLOG_DEBUG();
    <a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a> = <span class="keyword">new</span> QUdpSocket(<span class="keyword">this</span>);

    <span class="keywordflow">if</span>(<a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a>-&gt;bind(<a class="code" href="class_udp_echo_client.html#a88d2805cad5ad2dba77336583e5c6702">m_port</a>, QUdpSocket::ShareAddress) == <span class="keyword">false</span>){
        QLOG_ERROR() &lt;&lt; <span class="stringliteral">&quot;Cannot listen on port &quot;</span> &lt;&lt; <a class="code" href="class_udp_echo_client.html#a88d2805cad5ad2dba77336583e5c6702">m_port</a> &lt;&lt; <span class="stringliteral">&quot;, error &quot;</span> &lt;&lt; <a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a>-&gt;errorString();
    }
    
    connect(<a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a>, SIGNAL(readyRead()), <span class="keyword">this</span>, SLOT(<a class="code" href="class_udp_echo_client.html#ab828ca963e7387d8f28cbe8c5f88d8e6">onReply</a>()));
    <a class="code" href="class_udp_echo_client.html#a6b5875ed18c71a2a7966fea4362aa814">m_datagram</a>.append(<span class="stringliteral">&quot;Ciao Biloute&quot;</span>);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a1f32d159aaac158aed84b99a11bd7512"></a><!-- doxytag: member="UdpEchoClient::~UdpEchoClient" ref="a1f32d159aaac158aed84b99a11bd7512" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">UdpEchoClient::~UdpEchoClient </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8cpp_source.html#l00023">23</a> of file <a class="el" href="_udp_echo_client_8cpp_source.html">UdpEchoClient.cpp</a>.</p>
<div class="fragment"><pre class="fragment">{
    QLOG_DEBUG();
}
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ab828ca963e7387d8f28cbe8c5f88d8e6"></a><!-- doxytag: member="UdpEchoClient::onReply" ref="ab828ca963e7387d8f28cbe8c5f88d8e6" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UdpEchoClient::onReply </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [private, slot]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8cpp_source.html#l00028">28</a> of file <a class="el" href="_udp_echo_client_8cpp_source.html">UdpEchoClient.cpp</a>.</p>
<div class="fragment"><pre class="fragment">{
    QLOG_INFO();
    QByteArray datagram;
    QHostAddress address;
    quint16 port;
    
    datagram.resize(<a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a>-&gt;pendingDatagramSize());
    <a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a>-&gt;readDatagram(datagram.data(),datagram.size(), &amp;address, &amp;port);
    emit <a class="code" href="class_udp_echo_client.html#a7e5e7c8b80ab2802c056b04370e2f44c">reply</a>();
}
</pre></div>
</div>
</div>
<a class="anchor" id="a7e5e7c8b80ab2802c056b04370e2f44c"></a><!-- doxytag: member="UdpEchoClient::reply" ref="a7e5e7c8b80ab2802c056b04370e2f44c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UdpEchoClient::reply </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [signal]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="af9885baea55efc4fc611605e087d6427"></a><!-- doxytag: member="UdpEchoClient::send" ref="af9885baea55efc4fc611605e087d6427" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UdpEchoClient::send </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8cpp_source.html#l00040">40</a> of file <a class="el" href="_udp_echo_client_8cpp_source.html">UdpEchoClient.cpp</a>.</p>
<div class="fragment"><pre class="fragment">{
    QLOG_INFO();
    <a class="code" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">m_pUdpSocket</a>-&gt;writeDatagram(<a class="code" href="class_udp_echo_client.html#a6b5875ed18c71a2a7966fea4362aa814">m_datagram</a>.data(), <a class="code" href="class_udp_echo_client.html#a6b5875ed18c71a2a7966fea4362aa814">m_datagram</a>.size(), <a class="code" href="class_udp_echo_client.html#ab7e8f9607c4478554bebde8c4adc2147">m_address</a>, <a class="code" href="class_udp_echo_client.html#a88d2805cad5ad2dba77336583e5c6702">m_port</a>);
}
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="ab7e8f9607c4478554bebde8c4adc2147"></a><!-- doxytag: member="UdpEchoClient::m_address" ref="ab7e8f9607c4478554bebde8c4adc2147" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QHostAddress <a class="el" href="class_udp_echo_client.html#ab7e8f9607c4478554bebde8c4adc2147">UdpEchoClient::m_address</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8h_source.html#l00025">25</a> of file <a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a>.</p>

</div>
</div>
<a class="anchor" id="a6b5875ed18c71a2a7966fea4362aa814"></a><!-- doxytag: member="UdpEchoClient::m_datagram" ref="a6b5875ed18c71a2a7966fea4362aa814" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QByteArray <a class="el" href="class_udp_echo_client.html#a6b5875ed18c71a2a7966fea4362aa814">UdpEchoClient::m_datagram</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8h_source.html#l00027">27</a> of file <a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a>.</p>

</div>
</div>
<a class="anchor" id="a88d2805cad5ad2dba77336583e5c6702"></a><!-- doxytag: member="UdpEchoClient::m_port" ref="a88d2805cad5ad2dba77336583e5c6702" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_udp_echo_client.html#a88d2805cad5ad2dba77336583e5c6702">UdpEchoClient::m_port</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8h_source.html#l00026">26</a> of file <a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a>.</p>

</div>
</div>
<a class="anchor" id="ade73b42026a761a494025b7c753c9ac4"></a><!-- doxytag: member="UdpEchoClient::m_pUdpSocket" ref="ade73b42026a761a494025b7c753c9ac4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QUdpSocket* <a class="el" href="class_udp_echo_client.html#ade73b42026a761a494025b7c753c9ac4">UdpEchoClient::m_pUdpSocket</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_udp_echo_client_8h_source.html#l00024">24</a> of file <a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_udp_echo_client_8h_source.html">UdpEchoClient.h</a></li>
<li><a class="el" href="_udp_echo_client_8cpp_source.html">UdpEchoClient.cpp</a></li>
</ul>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
